//
//  LoginViewController.m
//  TenThousand
//
//  Created by 我的 on 16/6/22.
//  Copyright © 2016年 baixue. All rights reserved.
//

#import "LoginViewController.h"
#import "RegisterViewController.h"

@interface LoginViewController ()
@property (weak, nonatomic) IBOutlet UIButton *nextBtn;

@property (weak, nonatomic) IBOutlet UIButton *agreedBtn;//同意按钮
@property (weak, nonatomic) IBOutlet UITextField *mobileNum;//填写手机号
@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"手机号";
    [self createLeft:[UIImage imageNamed:@"ZHSZicon_03"] leftClick:^{
        [self.navigationController popViewControllerAnimated:YES];
    } right:nil rightClick:nil];
    
    self.agreedBtn.selected = YES;

}

/**
 *  是否选中同意按钮
 *  选中 进行下一步
 *  未选中  下一步按钮enabled设为NO
 */

- (IBAction)agreeClicked:(UIButton *)sender {
    if (sender.selected) {
        sender.selected = NO;
        _nextBtn.enabled = NO;
    }else{
        sender.selected = YES;
        _nextBtn.enabled = YES;
    }
    
    
}

//下一步  调到注册、登录页面
- (IBAction)nextBtn:(id)sender {
    
    //判断输入的手机号码是否为合法
    if (![PhoneNumStandard isStandardOrNotWithPhoneNumber:_mobileNum.text]) {
        [ToastView showInfoWithStatus:@"手机号输入不合法，请重新输入"];
    }else{
        RegisterViewController *registerView = [[RegisterViewController alloc] init];
        [self setHidesBottomBarWhenPushed:YES];
        registerView.mobile = [NSString stringWithFormat:@"%@",_mobileNum.text];//将手机号传到下一页注册
        //    NSLog(@"%@",registerView.mobile);
        [self.navigationController pushViewController:registerView animated:YES];
        
    }

}


- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

{
    
    [self.view.window endEditing:YES];
    
}

@end
